/**
 * Copyright (C) 2009+ Spark Zheng
 *
 * @file        src/filter.h 
 * @date        2010-04-05
 * @brief	general_datastream
 * @see         dserver
 * @history
 */

#ifndef _DSERVER_FILTER_H
#define _DSERVER_FILTER_H

#ifdef __cplusplus
extern "C" {
#endif

#include <dlib/global.h>
#include <dlib/lock.h>
#include <dlib/bit.h>
#include <dlib/mempool.h>

#include "dserver.h"
#include "filt_types.h"

#define F_THREAD_MIN		"threads_min"
#define F_DEF_TMIN		2
#define F_THREAD_MAX		"threads_max"
#define F_DEF_TMAX		4
#define F_TIMEOUT		"timeout"
#define F_DEF_TIMEOUT		60
#define F_PRIORITY		"priority"
#define F_DEF_PRIORITY		2
#define F_PIPELINE_ID		"pipeline_id"
#define F_DEF_PIPELINE_ID	1
#define F_FILTER_ID		"filter_id"
#define F_DEF_FILTER_ID		1

/**
 * filter context struct
 */
struct filter_context {
	dlib_atomic_t	f_nr;		/** filter number */
	list_head_t	f_head;		/** filter list head */
	//dlib_lock_t	f_lock;
};


/**
 * filter_init
 * @brief filter module construct
 * @param dc: main context struct
 */
extern int filter_init(dserver_t *dc);

/**
 * filter_exit
 * @brief filter module destruct
 * @param dc: main context struct
 */
extern void filter_exit(dserver_t *dc);

#ifdef __cplusplus
}
#endif
#endif
